package com.homegoods.goods.item;

import android.view.View;

import com.alibaba.android.arouter.launcher.ARouter;
import com.homegoods.goods.R;
import com.homegoods.goods.model.ClassifyModel;
import com.homegoods.aroutercomment.ARouterPath;
import com.kedll.library.adapter.MultiTypeAdapter;
import com.kedll.library.mvp.BaseItem;

/**
 * @author QiQi
 * @ClassName: ClassifyItem
 * @date 2018/9/7
 * @description
 */
public class ClassifyItem extends BaseItem<ClassifyModel> {

    public ClassifyItem(ClassifyModel data, MultiTypeAdapter adapter) {
        super(data);
        setOnClickListener(v -> ARouter.getInstance()
                .build(ARouterPath.PATH_GOODS_DETAIL)
                .navigation());
    }

    public String getRecommendPath() {
        return getData().getRecommendPath();
    }


    public String getRecommendShopName() {
        return getData().getRecommendShopName();
    }


    public String getRecommendShopMoney() {
        return String.format("￥%s", getData().getRecommendShopMoney());
    }


    public String getRecommendShopPeople() {
        return String.format("%s人付款", getData().getRecommendShopPeople());
    }

    /**
     * 是否显示爆款
     *
     * @return
     */
    public int getFireVisibility() {
        return getData().getRecommendFire() > 0 ? View.VISIBLE : View.GONE;
    }

    /**
     * 是否显示几种颜色
     *
     * @return
     */
    public int getColorVisibility() {
        return getData().getRecommendColor() > 0 ? View.VISIBLE : View.GONE;
    }

    public String getRecommendColor() {
        return String.format("%s色可选", getData().getRecommendColor());
    }

    @Override
    public int getLayout() {
        return R.layout.item_classify;
    }
}
